<template>
	<view>
		<template v-for="item in data">
			<el-menu-item v-if="!item.children || !item.children.length" :index="item.menu_id">
				<i :class="item.icon" class="icon-margin"></i>
				<span class="title">{{item.text }}</span>
			</el-menu-item>
			<el-sub-menu v-else :index="item.menu_id">
				<template #title>
					<i :class="item.icon" class="icon-margin"></i>
					<span class="title">{{ item.text }}</span>
				</template>
				<sub-menu :data="item.children"></sub-menu>
			</el-sub-menu>
		</template>
	</view>
</template>

<script>
	export default {
		name: "sub-menu",
		props: {
			data: {
				type: Array,
			}
		},
		data() {
			return {};
		},
		computed: {

		},
		methods: {

		}
	}
</script>

<style lang="scss" scoped>
	.icon-margin {
		margin-right: 20px !important;
	}
</style>